package com.dg11185.nearshop.app;

import com.android.nearshop.R;
import com.dg11185.libs.imageloader.core.DisplayImageOptions;
import com.dg11185.libs.imageloader.core.ImageLoader;

/**
 * 默认参数的构建工厂
 * 
 * @author：Daibo
 * @time：2014-5-13 下午8:35:58
 */

public class DefaultFactory {
    private static DisplayImageOptions options = null;

    /**
     * 图片加载默认配置的Option 调用{@link ImageLoader}
     * ,如果有大图不调用cacheInMemory(),调用.memoryCache(new WeakMemoryCache())
     */
    public static DisplayImageOptions getImageoptions() {
        if (options != null) {
            return options;
        } else {

            options = new DisplayImageOptions.Builder().showStubImage(R.drawable.web_image_background).cacheInMemory()
                    .cacheOnDisc().showImageOnFail(R.drawable.web_image_background)
                    .showImageForEmptyUri(R.drawable.web_image_background).resetViewBeforeLoading().build();
        }
        return options;
    }
}
